/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pradoeditor.helpers;

import java.io.File;
import javax.swing.JOptionPane;
import pradoeditor.comun.logger.CustomLogger;
import pradoeditor.comun.logger.LoggerHelper;
import pradoeditor.resources.text.MessagesCodes;
import pradoeditor.resources.text.MessagesManager;

/**
 *
 * @author jaime
 */
public  class IOHelper
{
    /**
     * Permite crear un directorio recibiendo como parametro el directorio a crear.
     * @param path
     * @return
     */
    public static boolean createDirectory(String path)
    {
        boolean lReturn = false;

        try
        {
            lReturn = (new File(path)).mkdir();
        }
        catch (Exception e)
        {
            lReturn = false;
            CustomLogger.writeError(IOHelper.class.getName(), e);
            JOptionPane.showMessageDialog(null, ERROR_CREATE_DIRECTORY + " " + path);
        }
        return lReturn;
    }
    
    private static final String ERROR_CREATE_DIRECTORY = MessagesManager.getMessage(MessagesCodes.helpers_iohelper_ERROR_CREATE_DIRECTORY);
}
